package org.dromara.quickswing.events;
import com.google.common.eventbus.Subscribe;
import org.dromara.quickswing.QSApplication;


public abstract class QSEventListener<T extends QSApplication> {
    protected final transient T app;
    protected final QSEventData data = new QSEventData();

    public QSEventListener(T app) {
        this.app = app;
    }

    public QSEventListener() {
        this.app = null;
    }

    public void put(String key, Object value) {
        data.put(key, value);
    }

    @Subscribe
    private void subscribe(QSEvent event) {
        this.onEvent(event);
    }

    protected abstract void onEvent(QSEvent event);
}